package com.ohos.connect.devicecloud.mqtt.modular.mqtt.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ohos.connect.devicecloud.mqtt.modular.mqtt.model.dto.MqttLoginDTO;
import com.ohos.connect.devicecloud.mqtt.modular.mqtt.service.MqttService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * MQTT控制器
 */
@Api(tags = "MQTT")
@ApiSupport(author = "OHOS_CONNECT_TEAM", order = 1)
@RestController
@RequestMapping(value = "/api/v1/device_cloud/mqtt")
@Validated
public class MqttController {

    @Resource
    private MqttService mqttService;

    /**
     * MQTT登录
     **/
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "MQTT认证",hidden = true)
    @PostMapping("/auth")
    public ResponseEntity<Map<String,Object>> loginMqtt(@RequestBody MqttLoginDTO mqttLoginDTO) {
        return mqttService.mqttLoginAuth(mqttLoginDTO);
    }


}
